package some.black.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import some.black.dao.BlackDao;
import some.black.domain.BlackCommand;
import some.member.dao.MemberDao;

@Controller
public class BlackDetailController {
	
	@Autowired
	private BlackDao blackDao;
	

	@Autowired
	private MemberDao memberDao;
	@RequestMapping("adminBlackDetail.do")
	public ModelAndView form(@RequestParam("num")int num){
		
		BlackCommand blackCommand = blackDao.getBlackCommand(num);
		String suspect = blackCommand.getSuspect();
		
		int blackGrade = memberDao.getMember(suspect).getGrade();
		int reportCount = blackDao.getReportCount(suspect);
		
		ModelAndView mav = new ModelAndView();
		mav.setViewName("adminBlackDetail");
		mav.addObject("blackCommand",blackCommand);
		mav.addObject("reportCount",reportCount);
		mav.addObject("blackGrade", blackGrade);
		
		return mav;
	}
	
	
}
